async function loopFetch() {
    const data = []

    let total = Infinity
    const fetchBody = {
        session: session,
        limit: 1000,
        formCode: formCode,
        offset: 0,
        auth: auth,
        action: action,
        filter: filter,
    }
    while (fetchBody.offset < total) {
        let res = await fetchData(fetchBody)
        if (res.code !== 200) {
            _funcCb(true, {
                isSuccess: false,
                reason: res.reason
            })
            break
        } else {
            total = res.total
            data.push(...res.data)
            fetchBody.offset += fetchBody.limit
        }
    }
    _funcCb(true, {
        isSuccess: true,
        data: data,
        total: total
    })
}

async function fetchData(fetchBody) {
    const res = await fetch('/api/11260689/getFormList', {
        method: "POST",
        body: JSON.stringify(fetchBody),
    })
    return await res.json()
}

loopFetch()